package com.admin.rxandroidtest;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;

import com.admin.rxandroidtest.retrofit.RetrofitActivity;
import com.admin.rxandroidtest.retrofitRxAndroid.RetRxAndroidActivity;
import com.admin.rxandroidtest.rxAndroid.RxAndroidActivity;

/**
 * Created by 吴昶 on 2018/8/16.
 */
public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Button btn1=(Button)findViewById(R.id.btn_retrofit);
        Button btn2=(Button)findViewById(R.id.btn_retrofit_rxAndroid);
        Button btn3=(Button)findViewById(R.id.btn_rxandroid);

        btn1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                toActivity(RetrofitActivity.class);
            }
        });
        btn2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                toActivity(RetRxAndroidActivity.class);
            }
        });
        btn3.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                toActivity(RxAndroidActivity.class);
            }
        });


    }

    private void toActivity(Class clazz){
        Intent intent=new Intent(this,clazz);
        startActivity(intent);
    }

}
